<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <div>question:<input type="text" v-model="question"></div>
        <div>answer:{{answer}}</div>
        <div><button @click="stop">stop</button></div>
    </div>
</body>
<script type="module">
    import {
        createApp,
        reactive,
        watch,
        watchEffect,
        ref
    } from '../node_modules/vue/dist/vue.esm-browser.js'
    createApp({
        setup() {
            const question = ref('')
            const answer = ref('')
            // watch(question, async () => {
            //     const res = await fetch('https://www.yesno.wtf/api')
            //     answer.value = await res.json()

            // })
            const stop = watchEffect(()=>{
                console.log(question.value)
            })
            return {
                question,
                answer,
                stop
            }
        }
    }).mount('#app')
</script>

</html>